package com.baidu.shop.service;

import com.alibaba.fastjson.JSONObject;
import com.baidu.shop.base.Result;
import com.baidu.shop.dto.Car;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;

/**
 * @Description:
 * @ClassName: CarService
 * @Author: User
 * @date: 2020.10.19 18:58
 * @version: 1.0
 */
@Api(tags = "购物车接口")
public interface CarService {
    @ApiOperation(value = "添加商品到购物车")
    @PostMapping(value = "car/addCar")
    Result<JSONObject> addCar(@RequestBody Car car,@CookieValue("MRSHOP_TOKEN") String token);

    @ApiOperation(value = "合并购物车")
    @PostMapping(value = "car/mergeCar")
    Result<JSONObject> mergeCar(@RequestBody String clientCarList, @CookieValue("MRSHOP_TOKEN") String token);

    @ApiOperation(value = "根据商品id删除购物车")
    @DeleteMapping(value = "car/delCar")
    Result<JSONObject> delCar(String delCarIds, @CookieValue("MRSHOP_TOKEN") String token);

    @ApiOperation(value = "根据商品id恢复购物车")
    @PutMapping(value = "car/recoverCar")
    Result<JSONObject> recoverCar(@RequestBody String recoverId, @CookieValue("MRSHOP_TOKEN") String token);

    @ApiOperation(value = "获取redis中购物车数据")
    @GetMapping(value = "car/getUserGoodsCar")
    Result<HashMap<String, List<Car>>> getUserGoodsCar(@CookieValue("MRSHOP_TOKEN") String token);

    @ApiOperation(value = "修改redis中购物车数据")
    @GetMapping(value = "car/carNumUpdate")
    Result<JSONObject> carNumUpdate(Long skuId ,Integer type ,@CookieValue(value = "MRSHOP_TOKEN") String token);
}
